home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 November / EnigmA AMIGA RUN 02 (1995)(G.R. Edizioni)(IT)[!][issue 1995-11][Skylink CD].iso / earcd / gfx / jpegaga2.lha / jpegAGAsrc / ppm2aga / pbm.h < prev    next >
C/C++ Source or Header  |  1993-12-24  |  1KB  |  48 lines

  1. /* pbm.h - header file for libpbm portable bitmap library
  2. */
  3.  
  4. #ifndef _PBM_H_
  5. #define _PBM_H_
  6.  
  7. #include "pbmplus.h"
  8.  
  9. typedef unsigned char bit;
  10. #define PBM_WHITE 0
  11. #define PBM_BLACK 1
  12.  
  13.  
  14. /* Magic constants. */
  15.  
  16. #define PBM_MAGIC1 'P'
  17. #define PBM_MAGIC2 '1'
  18. #define RPBM_MAGIC2 '4'
  19. #define PBM_FORMAT (PBM_MAGIC1 * 256 + PBM_MAGIC2)
  20. #define RPBM_FORMAT (PBM_MAGIC1 * 256 + RPBM_MAGIC2)
  21. #define PBM_TYPE PBM_FORMAT
  22.  
  23.  
  24. /* Macro for turning a format number into a type number. */
  25.  
  26. #define PBM_FORMAT_TYPE(f) ((f) == PBM_FORMAT || (f) == RPBM_FORMAT ? PBM_TYPE : -1)
  27.  
  28.  
  29. /* Declarations of routines. */
  30.  
  31. void pbm_init( int* argcP, char* argv[] );
  32.  
  33. #define pbm_allocarray( cols, rows ) ((bit**) pm_allocarray( cols, rows, sizeof(bit) ))
  34. #define pbm_allocrow( cols ) ((bit*) pm_allocrow( cols, sizeof(bit) ))
  35. #define pbm_freearray( bits, rows ) pm_freearray( (char**) bits, rows )
  36. #define pbm_freerow( bitrow ) pm_freerow( (char*) bitrow )
  37.  
  38. bit** pbm_readpbm( FILE* file, int* colsP, int* rowsP );
  39. void pbm_readpbminit( FILE* file, int* colsP, int* rowsP, int* formatP );
  40. void pbm_readpbmrow( FILE* file, bit* bitrow, int cols, int format );
  41. char* pm_read_unknown_size( FILE* file, long* buf );
  42.  
  43. void pbm_writepbm( FILE* file, bit** bits, int cols, int rows, int forceplain );
  44. void pbm_writepbminit( FILE* file, int cols, int rows, int forceplain );
  45. void pbm_writepbmrow( FILE* file, bit* bitrow, int cols, int forceplain );
  46.  
  47. #endif /*_PBM_H_*/
  48.